home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / visual2a / menu.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-09-25  |  11.5 KB  |  397 lines

  1. VERSION 5.00
  2. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
  3. Begin VB.Form Menu 
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Options"
  6.    ClientHeight    =   3390
  7.    ClientLeft      =   0
  8.    ClientTop       =   -60
  9.    ClientWidth     =   4680
  10.    Icon            =   "Menu.frx":0000
  11.    LinkTopic       =   "Form2"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    Moveable        =   0   'False
  16.    ScaleHeight     =   3390
  17.    ScaleWidth      =   4680
  18.    ShowInTaskbar   =   0   'False
  19.    Begin VB.CheckBox Check3 
  20.       Caption         =   "Screen Saver &Mode"
  21.       Height          =   255
  22.       Left            =   240
  23.       TabIndex        =   12
  24.       Top             =   3840
  25.       Width           =   2535
  26.    End
  27.    Begin VB.CommandButton Command4 
  28.       Caption         =   "&Cancel"
  29.       Height          =   495
  30.       Left            =   2400
  31.       TabIndex        =   14
  32.       Top             =   4200
  33.       Width           =   2055
  34.    End
  35.    Begin VB.CommandButton Command3 
  36.       Caption         =   "Save &Options"
  37.       Height          =   495
  38.       Left            =   240
  39.       TabIndex        =   13
  40.       Top             =   4200
  41.       Width           =   2055
  42.    End
  43.    Begin VB.CommandButton Command2 
  44.       Caption         =   "Change &PassWord"
  45.       Height          =   315
  46.       Left            =   2040
  47.       TabIndex        =   11
  48.       Top             =   3480
  49.       Width           =   2415
  50.    End
  51.    Begin VB.CheckBox Check2 
  52.       Caption         =   "&Require PassWord"
  53.       Height          =   255
  54.       Left            =   240
  55.       TabIndex        =   10
  56.       Top             =   3480
  57.       Width           =   1815
  58.    End
  59.    Begin VB.CheckBox Check1 
  60.       Caption         =   "&Delete Trails"
  61.       Height          =   255
  62.       Left            =   240
  63.       TabIndex        =   2
  64.       Top             =   960
  65.       Width           =   1455
  66.    End
  67.    Begin VB.CommandButton Command1 
  68.       Caption         =   "C&lear Screen"
  69.       Height          =   315
  70.       Left            =   3000
  71.       TabIndex        =   9
  72.       Top             =   3000
  73.       Width           =   1455
  74.    End
  75.    Begin VB.ComboBox Combo1 
  76.       Height          =   315
  77.       ItemData        =   "Menu.frx":0442
  78.       Left            =   1440
  79.       List            =   "Menu.frx":0455
  80.       Style           =   2  'Dropdown List
  81.       TabIndex        =   8
  82.       Top             =   3000
  83.       Width           =   1455
  84.    End
  85.    Begin ComctlLib.Slider Slider1 
  86.       Height          =   495
  87.       Left            =   120
  88.       TabIndex        =   1
  89.       Top             =   360
  90.       Width           =   4335
  91.       _ExtentX        =   7646
  92.       _ExtentY        =   873
  93.       _Version        =   327682
  94.       LargeChange     =   1
  95.       Min             =   1
  96.       SelStart        =   1
  97.       Value           =   1
  98.    End
  99.    Begin ComctlLib.Slider Slider2 
  100.       Height          =   495
  101.       Left            =   120
  102.       TabIndex        =   4
  103.       Top             =   1560
  104.       Width           =   4335
  105.       _ExtentX        =   7646
  106.       _ExtentY        =   873
  107.       _Version        =   327682
  108.       LargeChange     =   1
  109.       Max             =   50
  110.    End
  111.    Begin ComctlLib.Slider Slider3 
  112.       Height          =   495
  113.       Left            =   120
  114.       TabIndex        =   6
  115.       Top             =   2400
  116.       Width           =   4335
  117.       _ExtentX        =   7646
  118.       _ExtentY        =   873
  119.       _Version        =   327682
  120.       LargeChange     =   1
  121.       Min             =   2
  122.       Max             =   4
  123.       SelStart        =   2
  124.       Value           =   2
  125.    End
  126.    Begin VB.Label Label4 
  127.       Caption         =   "&Number of Sides:"
  128.       Height          =   255
  129.       Left            =   240
  130.       TabIndex        =   5
  131.       Top             =   2160
  132.       Width           =   2295
  133.    End
  134.    Begin VB.Label Label3 
  135.       Caption         =   "&Trail Size"
  136.       Height          =   255
  137.       Left            =   240
  138.       TabIndex        =   3
  139.       Top             =   1320
  140.       Width           =   2295
  141.    End
  142.    Begin VB.Label Label2 
  143.       Caption         =   "Line &Style:"
  144.       Height          =   255
  145.       Left            =   240
  146.       TabIndex        =   7
  147.       Top             =   3045
  148.       Width           =   1215
  149.    End
  150.    Begin VB.Label Label1 
  151.       Caption         =   "Line &Width:"
  152.       Height          =   255
  153.       Left            =   240
  154.       TabIndex        =   0
  155.       Top             =   120
  156.       Width           =   2295
  157.    End
  158.    Begin VB.Menu mnuFile 
  159.       Caption         =   "File"
  160.       Visible         =   0   'False
  161.       Begin VB.Menu mnuOptions 
  162.          Caption         =   "&Options"
  163.       End
  164.       Begin VB.Menu SP1 
  165.          Caption         =   "-"
  166.       End
  167.       Begin VB.Menu mnuAbout 
  168.          Caption         =   "&About"
  169.       End
  170.       Begin VB.Menu SP2 
  171.          Caption         =   "-"
  172.       End
  173.       Begin VB.Menu mnuExit 
  174.          Caption         =   "&Exit"
  175.       End
  176.    End
  177. Attribute VB_Name = "Menu"
  178. Attribute VB_GlobalNameSpace = False
  179. Attribute VB_Creatable = False
  180. Attribute VB_PredeclaredId = True
  181. Attribute VB_Exposed = False
  182. Option Compare Text
  183. Private Sub mnuAbout_Click()
  184. 'Generate a standard About Message Box
  185.     MsgBox "Programmed by Pedro Lamas" & vbCrLf & "Copyright 
  186. 1997-1999 Underground Software", vbApplicationModal + vbInformation, "Credits!"
  187. 'Enable the Drawing Timer
  188.     BlackBoard.Timer1.Enabled = True
  189. End Sub
  190. Private Sub Check1_Click()
  191. 'If the "Delete Trails" option is checked
  192.     If Check1.Value = 1 Then
  193. 'Enable the "Trails Size" Slider and the corresponding
  194. 'Label
  195.         Slider2.Enabled = True
  196.         Label3.Enabled = True
  197. 'Update the "Delete Lines" variable
  198.         DelLines = True
  199.     Else
  200. 'Disable the "Trails Size" Slider and the corresponding
  201. 'Label
  202.         Slider2.Enabled = False
  203.         Label3.Enabled = False
  204. 'Update the "Delete Lines" variable
  205.         DelLines = False
  206.     End If
  207. 'Redraw the Mistify
  208.     BlackBoard.Calc (2)
  209. End Sub
  210. Private Sub Check2_Click()
  211. 'Update the "Require Password" variable
  212.     P = -Check2.Value
  213. End Sub
  214. Private Sub Check3_Click()
  215. 'Update the "Screen Saver Mode Variable" variable
  216.     SS = -Check3.Value
  217. End Sub
  218. Private Sub Combo1_Click()
  219. 'Update the "Line Style" variable
  220.     DrawStyle = Combo1.ListIndex
  221. 'Clear the screen
  222.     BlackBoard.Cls
  223. End Sub
  224. Private Sub Command1_Click()
  225. 'Clear the screen
  226.     BlackBoard.Cls
  227. End Sub
  228. Private Sub Command2_Click()
  229. 'Local variable declaration
  230.     Dim S As String, SC As String
  231. 'If there is a already a password
  232.     If PSWD <> "" Then
  233. 'Ask for the current password
  234.         S = InputBox("Please enter the CURRENT PassWord:", "Change PassWord", "")
  235. 'Check if Cancel was pressed. If so, exit the Sub
  236.         If S = "" Then Exit Sub
  237. 'Check if the password is correct
  238.         If S <> PSWD Then
  239. 'Generate a Message Box, indicating an incorrect password
  240. 'and exit this Sub
  241.             MsgBox "Incorrect Password!", vbApplicationModal + vbCritical, "Change PassWord"
  242.             Exit Sub
  243.         End If
  244.     End If
  245. aqui:
  246. 'Ask for the new password
  247.     S = InputBox("Please enter the NEW PassWord:", "Change PassWord", "")
  248. 'Check if Cancel was pressed. If so, exit the Sub
  249.     If S = "" Then Exit Sub
  250. 'Ask for password confirmation
  251.     SC = InputBox("Please re-enter the NEW PassWord:", "Change PassWord", "")
  252. 'Check if Cancel was pressed. If so, exit the Sub
  253.     If SC = "" Then Exit Sub
  254. 'Confirm the entered passwords
  255.     If S <> SC Then
  256. 'If the passwords are different, generate an Error
  257. 'Message Box and go back to ask for the new password
  258.         MsgBox "PassWord not Checked!", vbApplicationModal + vbCritical, "Change PassWord"
  259.         GoTo aqui
  260.     End If
  261. 'Update the "Password" variable
  262.     PSWD = S
  263. End Sub
  264. Private Sub Command3_Click()
  265. 'OK was pressed. Save all options to the registry
  266.     SaveSetting "GraphicsSaver", "Op
  267. es", "RST", RST
  268.     SaveSetting "GraphicsSaver", "Op
  269. es", "DelLines", DelLines
  270.     SaveSetting "GraphicsSaver", "Op
  271. es", "Pts", Pts
  272.     SaveSetting "GraphicsSaver", "Op
  273. es", "DrawWidth", DrawWidth
  274.     SaveSetting "GraphicsSaver", "Op
  275. es", "DrawStyle", DrawStyle
  276.     SaveSetting "GraphicsSaver", "Op
  277. es", "PSWD", PSWD
  278.     SaveSetting "GraphicsSaver", "Op
  279. es", "P", P
  280.     SaveSetting "GraphicsSaver", "Op
  281. es", "SS", SS
  282. 'End the program
  283.     End
  284. End Sub
  285. Private Sub Command4_Click()
  286. 'Cancel was pressed. End the program
  287.     End
  288. End Sub
  289. Private Sub Form_Load()
  290.     On Error Resume Next
  291. 'Check if the program started in Windows Screen Saver
  292. 'Mode
  293.     If IsNumeric(Right(Command, 1)) = True Then
  294. 'If so, unload the Menu and exit this Sub
  295.         Unload Menu
  296.         Exit Sub
  297.     End If
  298. 'Get the saved settings
  299.     RST = GetSetting("GraphicsSaver", "Op
  300. es", "RST")
  301.     DelLines = GetSetting("GraphicsSaver", "Op
  302. es", "DelLines")
  303.     Pts = GetSetting("GraphicsSaver", "Op
  304. es", "Pts")
  305.     DrawWidth = GetSetting("GraphicsSaver", "Op
  306. es", "DrawWidth")
  307.     DrawStyle = GetSetting("GraphicsSaver", "Op
  308. es", "DrawStyle")
  309.     PSWD = GetSetting("GraphicsSaver", "Op
  310. es", "PSWD")
  311.     P = GetSetting("GraphicsSaver", "Op
  312. es", "P")
  313.     SS = GetSetting("GraphicsSaver", "Op
  314. es", "SS")
  315. 'Update the Menu control values
  316.     Slider1.Value = DrawWidth
  317.     Combo1.ListIndex = DrawStyle
  318.     Check1.Value = -DelLines
  319.     Slider2.Value = RST
  320.     Slider3.Value = Pts
  321.     Check2.Value = -P
  322.     Check3.Value = -SS
  323.     Check1_Click
  324. 'Check if the program started in Windows Screen Saver
  325. 'Mode
  326.     If Not Command Like "*/S*" Then
  327. 'If so, hide some Menu options and exit this Sub
  328.         Command1.Visible = False
  329.         Me.Height = 5190
  330.         Me.Show
  331.         Exit Sub
  332.     End If
  333. 'Hide the Menu
  334.     Hide
  335. 'If the "Screen Saver Mode" variable is True then hide
  336. 'the cursor
  337.     If SS = True Then ShowCursor 0
  338. 'Show the main Screen and start drawing
  339.     BlackBoard.Show
  340.     BlackBoard.Calc (1)
  341.     BlackBoard.Timer1.Enabled = True
  342. End Sub
  343. Private Sub Form_Unload(Cancel As Integer)
  344. 'Show the cursor on program end
  345.     ShowCursor 1
  346. End Sub
  347. Private Sub mnuOptions_Click()
  348. 'Option swas selected. Show the options and restart
  349. 'drawing
  350.     Menu.Show
  351.     BlackBoard.Timer1.Enabled = True
  352. End Sub
  353. Private Sub mnuExit_Click()
  354. 'Local variable declare
  355.     Dim S As String
  356. 'Check if "Require Password" variable is true and there
  357. 'is a valid password
  358.     If PSWD <> "" And P = True Then
  359. aqui:
  360. 'Ask the current password
  361.         S = InputBox("Please enter the PassWord", "Exit!", "")
  362. 'Check if Cancel was pressed
  363.         If S = "" Then
  364. 'If so continue drawing and exit this Sub
  365.             BlackBoard.Timer1.Enabled = True
  366.             Exit Sub
  367. 'Else, check if the password is correct
  368.         ElseIf S <> PSWD Then
  369. 'If it isn't generate an Error Message Box and go back to
  370. 'ask again the password
  371.             MsgBox "Incorrect PassWord!", vbApplicationModal + vbCritical, "Exit!"
  372.             GoTo aqui
  373.         End If
  374.     End If
  375. 'End the program
  376.     End
  377. End Sub
  378. Private Sub Slider1_Change()
  379. 'Update the "Line Width" variable
  380.     DrawWidth = Slider1.Value
  381. 'Clear the screen
  382.     BlackBoard.Cls
  383. End Sub
  384. Private Sub Slider2_Change()
  385. 'Update the "Trail Size" variable
  386.     RST = Slider2.Value
  387. 'Reset the leading trails to 0 and restart the drawing
  388.     A = 0
  389.     BlackBoard.Calc (2)
  390. End Sub
  391. Private Sub Slider3_Change()
  392. 'Update the "Number of Sides" variable
  393.     Pts = Slider3.Value
  394. 'Clear the screen
  395.     BlackBoard.Cls
  396. End Sub
  397.